how can i convert a .tpl file to a .php file? [closed]

Posted by kim on Stack Overflow See other posts from Stack Overflow or by kim
Published on 2011-01-14T03:55:12Z Indexed on 2011/01/14 9:53 UTC
Read the original article Hit count: 460

Filed under:
|

What do I do??

I am building a site and there is a categories.tpl that I want to go where sitemap.php is.

sorry i am brand new to all this. let me try to be more clear.id show you a picture but it is marking it as spam.

i have a menu at the top of my site like with any retail site. [About Cart Account and Products]. when you click products it takes to you the sitemap.php file. however i need the content from the categories.tpl to appear instead. (Categories in prestashop is another way of saying products)

here is the categories.tpl code:

{include file=$tpl_dir./breadcrumb.tpl} {include file=$tpl_dir./errors.tpl}

{if $category->id AND $category->active} {$category->name|escape:'htmlall':'UTF-8'} {$nb_products|intval} {if $nb_products>1}{l s='products'}{else}{l s='product'}{/if}

{if $scenes}
    <!-- Scenes -->
    {include file=$tpl_dir./scenes.tpl scenes=$scenes}
{else}
    <!-- Category image -->
    {if $category->id_image}
        <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" />
    {/if}
{/if}

{if $category->description}
    <div class="cat_desc">{$category->description}</div>
{/if}
{if isset($subcategories)}
<!-- Subcategories -->
<div id="subcategories">
    <h3>{l s='Subcategories'}</h3>
    <ul class="inline_list">
    {foreach from=$subcategories item=subcategory}
        <li>
            <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}">
                {if $subcategory.id_image}
                    <img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" />
                {else}
                    <img src="{$img_cat_dir}default-medium.jpg" alt="" />
                {/if}
            </a>
            <br />
            <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}</a>
        </li>
    {/foreach}
    </ul>
    <br class="clear"/>
</div>
{/if}

{if $products}
        {include file=$tpl_dir./product-sort.tpl}
        {include file=$tpl_dir./product-list.tpl products=$products}
        {include file=$tpl_dir./pagination.tpl}
    {elseif !isset($subcategories)}
        <p class="warning">{l s='There is no product in this category.'}</p>
    {/if}

{elseif $category->id} {l s='This category is currently unavailable.'}

{/if}

and here is the sitemap.php

include(dirname(FILE).'/config/config.inc.php'); include(dirname(FILE).'/header.php');

include(dirname(FILE).'/product-sort.php');

$nbProducts = intval(Product::getNewProducts(intval($cookie->id_lang), isset($p) ? intval($p) - 1 : NULL, isset($n) ? intval($n) : NULL, true)); include(dirname(FILE).'/pagination.php');

$smarty->assign(array( 'products' => Product::getNewProducts(intval($cookie->id_lang), intval($p) - 1, intval($n), false, $orderBy, $orderWay), 'nbProducts' => intval($nbProducts)));

$smarty->display(_PS_THEME_DIR_.'new-products.tpl');

include(dirname(FILE).'/footer.php');

?>

© Stack Overflow or respective owner

Related posts about php

Related posts about TPL